package com.sicheng.metadata.juc.callable;

import java.util.concurrent.ExecutionException;
import java.util.concurrent.FutureTask;

public class Future {
    public static void main(String[] args) {
        FutureTask<Integer> futureTask = new FutureTask<>(() -> 1023);

        new Thread(futureTask,"future").start();

        while (!futureTask.isDone())
            System.out.println("wait.....");
        try {
            System.out.println(futureTask.get());
        }  catch (ExecutionException | InterruptedException e) {
            e.printStackTrace();
        }
    }
}
